<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="/billing" prefix="b"%>
<%@page import="com.admin.service.ProvinceService"%>

<%@page import="com.admin.util.DateUtil"%>
<%@page import="java.util.Date"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计费后台管理</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/managercss.css">
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/wbox.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.4.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.form.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/wbox.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/validate.js"></script>
<script language="javascript" src="<%=request.getContextPath() %>/PopupCalendar/popup.js"></script>
<script type="text/javascript">
<!--
	$(function(){
		$(".list div").mousemove(function(){
			$(this).css("background","#E3EEFF");
		}).mouseout(function(){
			$(this).css("background","");
		});
		$("#provinceId").val('${provinceId}');
		$("#isp").val('${isp}');
		$("#vodCustomized").val('${vodCustomized}');
	});

	function del(spId){
		if(confirm("你确认删除该SP吗?")){
			$.ajax({
				url:"<%=request.getContextPath() %>/admin/sp/del/"+spId,
				type:"GET",
				success:function(flag){
					if(flag=='1'){
						alert("删除成功!");
						window.location.reload();
					}else{
						alert("删除失败!");
					}
				}
			});
		}
	}
	function addSp(){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/toadd",
			title: "添加新的SP"
		});
		wBox.showBox();
	}

	function fenpei(spid){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/tofenpei/"+spid,
			title: "分配SP通道"
		});
		wBox.showBox();
	}

	function show(spId){
		var wBox = $("#ajax").wBox({
			requestType: "iframe",
			iframeWH:{width:700,height:600},
			target:"<%=request.getContextPath() %>/admin/sp/"+spId,
			title: "查看SP"
		});
		wBox.showBox();
	}

	function changeCompany(companyId) {
		$.ajax({
			url:"<%=request.getContextPath() %>/admin/sp/selectSp?companyId="+companyId,
			type:"GET",
			success:function(result){
				$("#spId").html(result);
			}
		});
	}
//-->
</script>
</head>
<body>
<div class="information">
	<div class="title">
		统计列表
	</div>
	<div class="search">
	<%
	Date date = new Date(new Date().getTime()-24*3600*1000l);
	%>
		<form action="<%=request.getContextPath() %>/admin/game/videoList" method="post">
		<input name="txtDateStart" type="text" readonly="readonly" value="<%=DateUtil.formatDate(date) %>" id="txtDate" OnClick="calendar()" />
		<input name="txtDateEnd" type="text" value="<%=DateUtil.formatDate(date) %>" readonly="readonly" id="txtDateEnd" OnClick="calendar()" />
		<c:set value="${companyList}" var="companyList"></c:set>
		SP合作商
		<select name="companyId" id="companyId" style="width: 120px;" onchange="changeCompany(this.value)">
			<option value="0">请选择</option>
			<c:forEach items="${companyList}" var="p">
				<option value="${p.companyId }">${p.companyName }</option>
			</c:forEach>
		</select>
		SP通道
		<select name="spId" id="spId" style="width: 120px;">
			<option value="0">请选择</option>
		</select>
		<c:set value="${cpList}" var="cpList"></c:set>
		CP合作商
		<select name="cpId" id="cpId" style="width: 120px;">
			<option value="0">请选择</option>
			<c:forEach items="${cpList}" var="p">
				<option value="${p.id }">${p.cpname }</option>
			</c:forEach>
		</select>
		
		<input type="submit" value="查询">
		</form>
	
	<!-- 
		<form action="<%=request.getContextPath() %>/admin/game/gameList" method="post">
		<c:set value="${cpList}" var="cpList"></c:set>
		合作商
		<select name="cpid" id="cpId" style="width: 120px;">
			<option value="-1">-----请选择-----</option>
			<c:forEach items="${cpList}" var="p">
				<option value="${p.id }">${p.cpname }</option>
			</c:forEach>
		</select>
		<input type="submit" value="查询">
		</form> -->
	</div>
	<table align="center" width="100%">
		<tr class="list" align="center">
		<td style="width:100px;">cp</td>
		<td style="width:70px;">sp</td>
			<td style="width:70px;">时间</td>
			<td style="width:80px;">计费转化率</td>
			<td style="width:100px;">人均使用次数</td>
			<td style="width:80px;">登录用户数</td>
			<td style="width:60px;">使用人数</td>
			<td style="width:60px;">使用次数</td>
			<td style="width:60px;">按次费用</td>
			<td style="width:100px;">cp登录用户数</td>
			<td style="width:80px;">cp使用人数</td>
			<td style="width:80px;">cp使用次数</td>
			<td style="width:80px;">cp按次费用</td>
			
		</tr>
	
	
		<c:forEach items="${pageBean.result}" var="sp" varStatus="status">
		
			<tr class="${status.index%2==0?'noselect':'select' }" align="center">
				<td style="width:100px;">${sp.cpname }</td>
				<td style="width:100px;">${sp.spname }</td>
					<td style="width:70px;">${sp.dt }</td>
					<td style="width:80px;">${sp.feePercent==0?'无':sp.feePercent }%</td>
					<td style="width:100px;">${sp.avgUser/100 }</td>
					<td style="width:80px;">${sp.data1 }</td>	
					<td style="width:60px;">${sp.data2 }</td>		
					<td style="width:60px;">${sp.data3 }</td>
					<td style="width:60px;">${sp.data4 }</td>
					<td style="width:100px;">${sp.cpdata1 }</td>	
					<td style="width:80px;">${sp.cpdata2 }</td>		
					<td style="width:80px;">${sp.cpdata3 }</td>
					<td style="width:80px;">${sp.cpdata4 }</td>
					
			</tr>
		
		</c:forEach>
	</table>
	
	
	<!-- 
	<div class="listTitle">
		<ul>
			<li style="width:100px;">cp</li>
			<li style="width:70px;">时间</li>
			<li style="width:80px;">登录用户数</li>
			<li style="width:60px;">使用人数</li>
			<li style="width:60px;">使用次数</li>
			<li style="width:60px;">按次费用</li>
			<li style="width:100px;">cp登录用户数</li>
			<li style="width:80px;">cp使用人数</li>
			<li style="width:80px;">cp使用次数</li>
			<li style="width:80px;">cp按次费用</li>
			<li style="width:80px;">计费转化率</li>
			<li style="width:100px;">人均使用次数</li>
		</ul>
	</div>
	<div class="list">
		<c:forEach items="${pageBean.result}" var="sp" varStatus="status">
			<div class="${status.index%2==0?'noselect':'select' }">
				<ul>
					<li style="width:100px;">${sp.cpname }</li>
					<li style="width:70px;">${sp.dt }</li>
					<li style="width:80px;">${sp.data1 }</li>	
					<li style="width:60px;">${sp.data2 }</li>		
					<li style="width:60px;">${sp.data3 }</li>
					<li style="width:60px;">${sp.data4 }</li>
					<li style="width:100px;">${sp.cpdata1 }</li>	
					<li style="width:80px;">${sp.cpdata2 }</li>		
					<li style="width:80px;">${sp.cpdata3 }</li>
					<li style="width:80px;">${sp.cpdata4 }</li>
					<li style="width:80px;">${sp.feePercent==0?'无':sp.feePercent }%</li>
					<li style="width:100px;">${sp.avgUser/100 }</li>
					
				</ul>
				<div class="clear"></div>
			</div>
		</c:forEach>
	</div>
	 -->
	<jsp:include page="../page.jsp" flush="true"></jsp:include>
	<div class="search" align="center">
		<div class="list">
			<div class="select">
					<ul>
						<li style="width:100px;">登录用户数：</li>
						<li style="width:100px;">${all.data1 }</li>
						<li style="width:100px;">使用人数：</li>	
						<li style="width:100px;">${all.data2 }</li>	
						<li style="width:100px;">使用次数：</li>	
						<li style="width:100px;">${all.data3 }</li>		
						<li style="width:100px;">按次费用：</li>
						<li style="width:100px;">${all.data4 }</li>
					</ul>
					<div class="clear"></div>
					<ul>
						<li style="width:100px;">CP登录用户数：</li>
						<li style="width:100px;">${all.cpdata1 }</li>
						<li style="width:100px;">CP使用人数：</li>	
						<li style="width:100px;">${all.cpdata2 }</li>	
						<li style="width:100px;">CP使用次数：</li>	
						<li style="width:100px;">${all.cpdata3 }</li>		
						<li style="width:100px;">CP按次费用：</li>
						<li style="width:100px;">${all.cpdata4 }</li>
					</ul>
					<div class="clear"></div>
			</div>
		</div>
	</div>
</div>
</body>
</html>